class code3_2 {
    public int findKthLargest(int[] nums, int k) {
        //堆排序
        PriorityQueue<Integer> heap = new PriorityQueue<>();
        for(int num:nums) {
            heap.add(num);
            if(heap.size()>k) {
                heap.poll();
            }
        }
        return heap.peek();
    }
}